#ifndef INTERFACE_H

//--------------------------------------------------------
//		DEFINITIONS
//--------------------------------------------------------

#define INTERFACE_H
#define CATMULL_FRAME "CatmullFrame"
#define LOOP_FRAME "LoopFrame"
#define	RECON_OPACITY_DENOM 100; 
#define TIMER_INC 2
#define REWIND_INC 10

//--------------------------------------------------------
//		INCLUDES
//--------------------------------------------------------
#include <QtGui/QMainWindow>
#include <QTimer>
#include "ui_interface.h"
#include "ModelLocator.h"
#include "ModelFrame.h"
#include "ToolController.h"
#include "MeshRenderer.h"
#include "ToolButton.h"

//--------------------------------------------------------
//		CLASS: Interface
//--------------------------------------------------------
class Interface : public QMainWindow
{
	Q_OBJECT

public:

	//Constructor/destructor
	Interface	( QWidget *parent = 0, Qt::WFlags flags = 0);
	~Interface	( );

public slots:

	void openMeshFile		( );
	void subdivide			( );
	void setSubdivide		( int );
	void startCI			( );
	void startWI			( );
	void handleAnimation	( );
	void startTimer			( );
	void stopTimer			( );
	void updateSliderValue  ( int );
	void startZoomTimer		( );
	void stopZoomTimer		( );
	void startSE			( );
	void pointer			( );
	void onPlayPauseClick	( bool );
	void onCenterModelClick	( );
	void onConSliderChanged	( int );
	void onMeshSelected		( const Selection* );
	void doClearSharpEdges	( );
	void changeRenderMode	( );
	void onRewindTimeout	( );
	void onRewindClick		( );
	void maxConnSlider		( );

protected:
	void keyPressEvent(QKeyEvent * event);

signals:
	void modelLoaded		( );

private:

	bool				freezeSelection;	// prevent selection from disappearing
	bool				meshLoaded;			// flag: is there a mesh loaded?
	bool				subdivideAsap;		// flag to subdivide after animating
	Ui::InterfaceClass	ui;					// the auto-generated ui
	ModelLocator*		modelLocator;		// singleton to hold the mesh model
	ToolController*		toolController;		// controller for tool functions
	LoopSubdivider*		loopScheme;			// Loop subdivision scheme
	CatmullSubdivider*	catmullScheme;		// Catmull-Clark subdivision scheme
	Subdivider*			subdivider;
	QTimer*				theTimer;
	QTimer*				zoomTimer;
	QTimer*				rewindTimer;
	int					sliderValue;
	ToolButton*			activeButton;
	ToolButton*			lastTool;		// the most recent tool selected

	void centerModel	( bool );
	void toggleButton	( ToolButton* button );
	void setLastTool	(  );
	void pointerSilent	(  );	// another way of setting the pointer tool
};

#endif 
